<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body id="body">
<div role="treegrid">
  <div role="row" id="treegrid1-row1" tabindex="-1">
    <div role="rowheader">row head</div>
    <div role="gridcell">data</div>
  </div>
</div>
<div role="treegrid" aria-activedescendant="treegrid2-row1">
  <div role="row" id="treegrid2-row1">
    <div role="rowheader">row head</div>
    <div role="gridcell">data</div>
  </div>
</div>
<div role="grid">
  <div role="row" id="treegrid3-row1">
    <div role="rowheader">row head</div>
    <div role="gridcell">data</div>
  </div>
</div>
</body>

<script>
function axElementById(id) {
    return accessibilityController.accessibleElementById(id);
}

test(function(t) {
    var axRow = axElementById("treegrid1-row1");
    assert_equals(axRow.name, 'row head data');
}, "The row's name must concatenate the children if the row is focusable");

test(function(t) {
    var axRow = axElementById("treegrid2-row1");
    assert_equals(axRow.name, 'row head data');
}, "The row's name must concatenate the children if the parent has aria-activedescendant");

test(function(t) {
    var axRow = axElementById("treegrid3-row1");
    assert_equals(axRow.name, '');
}, "The row's name must empty when the parent is not focusable and there is no other labelling markup (for performance reasons)");

</script>
